package com.test.mongo.demo.dao;

import com.test.mongo.demo.entity.Hotel;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import javax.core.common.mongo.BaseDaoSupport;
import javax.core.common.mongo.QueryRule;
import java.util.List;

@Repository
public class HotelDao extends BaseDaoSupport<Hotel,Long> {

    public void getByName(String name){

        QueryRule queryRule = QueryRule.getInstance();

        super.find(queryRule);

    }

    public List<Hotel> getAll(){
        QueryRule queryRule = QueryRule.getInstance();
       return  super.find(queryRule);

    }
    @Resource(name = "mongoTemplate")
    @Override
    protected void setMongoTemplate(MongoTemplate template) {
        super.setMongoTemplate(template);
    }
}
